﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebSite.Master" AutoEventWireup="true"
    CodeBehind="MaterialList.aspx.cs" Inherits="RN.ERP.Web.Material.Material.MaterialList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="Stylesheet" type="text/css" href="../../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <link href="../../Styles/skins/blue/css/style.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/skins/blue/css/style_msg.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="../../Scripts/ligerUI/js/ligerui.min.js"></script>
    <script src="../../Scripts/ligerUI/js/common.js" type="text/javascript"></script>
    <script src="../../Scripts/ligerUI/js/LG.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/ligerUI/js/plugins/ligerGrid.js"></script>
    <script type="text/javascript" src="../../Scripts/ligerUI/js/plugins/ligerLayout.js"></script>
    <script type="text/javascript" language="javascript">
        function OpenAlert(text) {
            $.ligerDialog.warn(text);
            return false;
        }
        function ShowLog(id) {
            var url = "../MaterialLog.aspx?id=" + id + "&fid=MaterialInfo";
            var title = "查看日志";
            $.ligerDialog.open({ url: url, width: 600, height: 600, title: title, allowClose: false, buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
        }
        /*打开添加窗口*/
        function AddOrEditKC(type, mpid) {
            var pid = $("#hdnPid").val();
            var url, title;
            if (type == 0) {//添加
                url = "./MaterialInfo.aspx?type=0&pid=" + pid;
                title = "添加信息";
            }
            else if (type == 1) {//查看
                url = "./MaterialInfo.aspx?type=1&id=" + mpid + "&pid=" + pid;
                title = "详细信息";
            }
            else if (type == 2) {//修改
                url = "./MaterialInfo.aspx?type=2&id=" + mpid + "&pid=" + pid;
                title = "修改信息";
            }
            else {
                url = "./MaterialInfo.aspx?type=3&id=" + mpid + "&pid=" + pid;
                title = "添加信息";
            }
            //            alert($(window).height());
            //            alert($(window).width());
            $.ligerDialog.open({ url: url, width: $(window).width() - 10, height: $(window).height() - 10, title: title, allowClose: false, buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); RefreshWin() } }] });
        }
        function RefreshWin() {
            location.href = location.href;
        }
        function CloseWin(data) {
            if (data == "1") {
                RefreshWin();
            }
        }
        function KCInfo() {
            var chk = $("input:checked");
            if (chk.length == 0) {
                OpenAlert("请选择要导出的信息！");
                return false;
            }
            else {

                return false;
            }
        }
        function ShowSearch() {
            $.ligerDialog.open({ url: "MSearch.aspx", width: 600, height: 600, title: '查询物资', isResize: true, allowClose: false });
            return false;
        }
        function OnClientCloseCertType(args) {
            var arg = args;
            if (arg) {
                if (arg.Result == 0) {
                    return;
                }
                else {
                    alert(arg.condition);
                    $("#hdnCondition").val(arg.condition);
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                }
            }
        }
        $(function () {
            $('input[type="checkbox"]').click(function () {
                if ($(this).attr('checked')) {
                    $('input[type="checkbox"]').removeAttr('checked');
                    $(this).attr('checked', 'checked');
                }
            });
        })
    </script>
    <style type="text/css">
        .cell-label
        {
            width: 80px;
        }
        #tabcontainer .l-tab-links
        {
            border-top: 1px solid #D0D0D0;
            border-left: 1px solid #D0D0D0;
            border-right: 1px solid #D0D0D0;
        }
        
        .projectgrid .l-selected .l-grid-row-cell, .projectgrid .l-selected
        {
            background: none;
        }
        
        .access-icon
        {
            background: url(../images/checkbox.gif) 0px 0px;
            height: 13px;
            line-height: 13px;
            width: 13px;
            margin: 4px 20px;
            display: block;
            cursor: pointer;
        }
        .access-icon-selected
        {
            background-position: 0px -13px;
        }
        .l-panel td.l-grid-row-cell-editing
        {
            padding-bottom: 2px;
            padding-top: 2px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:radajaxmanager id="RadAjaxManager1" runat="server" onajaxrequest="RadAjaxManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGridList" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:radajaxmanager>
    <telerik:radajaxloadingpanel id="RadAjaxLoadingPanel1" runat="server" />
    <asp:HiddenField ID="hdnPid" runat="server" ClientIDMode="Static" />
    <asp:HiddenField ID="hdnCondition" runat="server" ClientIDMode="Static" />
    <table width="100%" style="table-layout: fixed; margin-top: 5px;" border="0" cellspacing="0"
        cellpadding="0" align="center">
        <tr>
            <td class="xx_m  tt_xx_l">
            </td>
            <td class="xx_m  tt_xx_icon">
            </td>
            <td style="width: auto;" class="xx_m">
                物资管理列表
            </td>
            <td style="width: 14px;">
                <img src="../../images/xx_r.jpg" width="14" height="33" />
            </td>
        </tr>
        <tr>
            <td class="left_con">
                &nbsp;
            </td>
            <td colspan="2" style="padding-left: 6px; padding-right: 6px;" valign="top">
                <div class="xian">
                    <div class="i-con-cn">
                        <%--<span id="edit" runat="server"><a style="cursor: pointer;" onclick="AddOrEditKC(2,0);"
                            class="xtbiao">修改</a> </span><span id="del" runat="server"><a style="cursor: pointer;"
                                class="a_del xtbiao">删除</a> </span>--%><span id="add" runat="server"><a style="cursor: pointer;"
                                    onclick="AddOrEditKC(0,0);" class="xtbiao">添加</a> </span><span id="Span3" runat="server">
                                        <a style="cursor: pointer;" onclick="ShowSearch();" class="xtbiao">查询</a>
                        </span>
                    </div>
                </div>
                <div>
                    <div class="xian">
                        <div class="about_title">
                            物资管理列表</div>
                    </div>
                    <telerik:radgrid id="RadGridList" runat="server" showstatusbar="True" allowsorting="True"
                        cssclass="tab" cellspacing="0" culture="zh-CN" gridlines="None" allowpaging="True"
                        allowcustompaging="True" onneeddatasource="RadGrid1_NeedDataSource" width="100%"
                        onitemcommand="RadGridList_ItemCommand">
                        <MasterTableView AutoGenerateColumns="false" DataKeyNames="ID" NoMasterRecordsText="暂无数据"
                            InsertItemPageIndexAction="ShowItemOnCurrentPage" CommandItemDisplay="Top">
                            <CommandItemSettings ExportToPdfText="Export to PDF" />
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="true">
                            </RowIndicatorColumn>
                            <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                </EditColumn>
                            </EditFormSettings>
                            <PagerStyle AlwaysVisible="True" />
                            <CommandItemTemplate>
                            </CommandItemTemplate>
                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridTemplateColumn HeaderText="选择" UniqueName="Choose" HeaderStyle-Width="5%"
                                    HeaderStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <input id="ckbChoose" type="checkbox" value='<%#Eval("ID") %>' runat="server" />
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="5%"></HeaderStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="物资分类" HeaderStyle-Width="10%" HeaderStyle-HorizontalAlign="Center"
                                    FilterControlAltText="Filter MPCodeColumn column" UniqueName="MPCode">
                                    <ItemTemplate>
                                        <%# Eval("cMCName")%>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="10%"></HeaderStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="物资名称" HeaderStyle-Width="10%" HeaderStyle-HorizontalAlign="Center"
                                    FilterControlAltText="Filter MPCodeColumn column" UniqueName="MPCode">
                                    <ItemTemplate>
                                        <%# Eval("cMName")%>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="10%"></HeaderStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="物资数量" HeaderStyle-Width="10%" HeaderStyle-HorizontalAlign="Center"
                                    FilterControlAltText="Filter MPCodeColumn column" UniqueName="MPCode">
                                    <ItemTemplate>
                                        <%# Eval("iMNum")%>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="10%"></HeaderStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="估算单价" HeaderStyle-Width="15%" HeaderStyle-HorizontalAlign="Center"
                                    FilterControlAltText="Filter  MPNamecolumn" UniqueName="MPName">
                                    <ItemTemplate>
                                        <%# FormatNum(Eval("dMEvaluate"))%>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="15%"></HeaderStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="总计" HeaderStyle-Width="15%" HeaderStyle-HorizontalAlign="Center"
                                    FilterControlAltText="Filter  MPNamecolumn" UniqueName="MPName">
                                    <ItemTemplate>
                                        <%# GetCount(Eval("dMEvaluate"),Eval("iMNum"))%>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="15%"></HeaderStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="备注" UniqueName="Memo" HeaderStyle-Width="20%"
                                    HeaderStyle-HorizontalAlign="Center" FilterControlAltText="Filter Memocolumn">
                                    <ItemTemplate>
                                        <%# Eval("cMemo")%>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" Width="20%"></HeaderStyle>
                                </telerik:GridTemplateColumn>
                                <%--<telerik:GridBoundColumn HeaderText="状态" UniqueName="Status" HeaderStyle-Width="5%"
                                    HeaderStyle-HorizontalAlign="Center" FilterControlAltText="Filter Status column">
                                    <HeaderStyle HorizontalAlign="Center" Width="15%"></HeaderStyle>
                                </telerik:GridBoundColumn>--%>
                                <%--<telerik:GridTemplateColumn FilterControlAltText="Filter Info column" HeaderText=""
                                    UniqueName="Info">
                                    <HeaderStyle Width="30%" />
                                </telerik:GridTemplateColumn>--%>
                                <telerik:GridTemplateColumn HeaderText="操作" HeaderStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnDel" runat="server" CssClass="ActionA RecordDel" OnClientClick="return confirm('确定删除？');"
                                            CommandName="del" CommandArgument='<%# Eval("ID") %>' title="删除"></asp:LinkButton>
                                        <span id="edit" runat="server"><a style="cursor: pointer;" onclick="AddOrEditKC(2,<%#Eval("ID") %>);"
                                            class="ActionA RecordEdit" title="编辑"></a> </span><span id="Span1" runat="server"><a style="cursor: pointer;"
                                                onclick="AddOrEditKC(1,<%#Eval("ID") %>);" class="ActionA RecordDetail" title="预览"></a> </span>
                                                <span id="Span2" runat="server"><a style="cursor: pointer;"
                                                onclick="ShowLog(<%#Eval("ID") %>);" class="ActionA RecordHistory" title="日志信息"></a> </span>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings EnableRowHoverStyle="true">
                            <Selecting AllowRowSelect="True"></Selecting>
                        </ClientSettings>
                        <PagerStyle AlwaysVisible="True" />
                        <FilterMenu EnableImageSprites="False">
                        </FilterMenu>
                    </telerik:radgrid>
                </div>
            </td>
            <td class="right_con">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="con_m tt_left_bottom">
                &nbsp;
            </td>
            <td colspan="2" class="con_m">
                &nbsp;
            </td>
            <td class="tt_right_bottom">
                &nbsp;
            </td>
        </tr>
    </table>
</asp:Content>
